import React, {Component} from 'react';
import {render} from 'react-dom';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import {createStore, applyMiddleware} from 'redux';
import thunk from 'redux-thunk';
import {
  Router,
  Route,
  IndexRoute,
  browserHistory,
  Link,
  Redirect
} from 'react-router';
import reducers from 'reducers/index';
import $ from 'jquery';
import '../css/bootstrap.min.css';
import '../css/swiper.min.css';
import './common.scss';
import '../js/plugins/bootstrap.min.js';
import '../js/plugins/swiper.min.js';
import Index from './index/IndexBlock';
import List from './list/ListBlock';
import WaitList from './waitlist/WaitList';
import Detail from './detail/DetailBlock';
import FooterBlock from './footer/FooterBlock';
import MyAuction from './user/MyAuction';

class Application extends Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

render() {
    return (
      <div>
        {this.props.children}
        <FooterBlock/>
      </div>
    );
  }
}

const store = createStore(reducers, {}, applyMiddleware(thunk));
render((
  <Provider store={store}>
    <Router history={browserHistory}>
      <Route path="/" component={Application}>
        <IndexRoute component={Index}/>
        <Route path="/mindex.php" component={Index}>
          <Redirect from="/" to="/mindex.php"/>
        </Route>
        <Route path="list" component={List}/>
        <Route path="myauction" component={MyAuction}/>
        <Route path="waitlist" component={WaitList}/>
        <Route path="detail/:id" component={Detail}/>
      </Route>
    </Router>
  </Provider>
), document.getElementById('app'));
